import request from '@/utils/request';
import axios from 'axios'
import { converErrorCodeToMsg } from '../utils/utils';

export async function query({...resetParams}) {
  // return request(`/pressure_sensors`,{
  //   method:'GET',
  //   params:{
  //     ...resetParams
  //   }
  // });
  return request(`/guest/pressure_sensors`,{
    method:'GET',
    params:{
      ...resetParams
    }
  });
}

export async function queryWater({...resetParams}) {
  return request(`/guest/waterworks_device_latest_data`,{
    method:'GET',
  });
}
export async function queryAllstreet({...resetParams}) {
  return request(`/guest/annotations/pipe_street`,{
    method:'GET',
  });
}
export async function queryWorkstations1({...resetParams}) {
  return request(`/guest/all_workstations`,{
    method:'GET',
    params:{
      // template:1
    }
  });
}

export async function queryPipe() {
  console.log('queryPipe')
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3Anewpipeline&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      console.log('response',response)
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}
export async function queryDesignPipe() {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3Apipeline&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      console.log('response',response)
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryHolecover() {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3Amanholecover&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      console.log('response',response)
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryReducevalve() {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3Areducevalve&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      console.log('response',response)
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryAppendageCharac(payload) {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3Apoints%3A${payload.url}&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryACAD_4(payload) {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3AACAD_%E8%B7%AF%E5%90%8D_LineString&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryACAD_6(payload) {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3AACAD_6%E6%B0%B4%E7%B3%BB_LineString&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryACAD_3(payload) {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3AACAD_4%E4%BA%A4%E9%80%9A_LineString&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

export async function queryACAD_2(payload) {
  return axios(`https://test.zhsgy.top:37405/geoserver/tulufan/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tulufan%3AACAD_2%E5%B1%85%E6%B0%91%E5%9C%B0_LineString&outputFormat=application%2Fjson`, {
    method:'GET',
  })
    .then(response => {
      return response
    })
    .catch((error) => {
      console.log('error',error);
      return error;
    });
}

